<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * push入栈，pop出栈
         * unshift头部插入，shift头部弹出
         * 出栈操作返回的是弹出的元素
         * 入栈操作返回的是操作后数组的长度
         * fill填充
         */
        const arr = Array(3).fill(undefined)
        console.log(arr); // [undefined, undefined, undefined]

        const arr2 = Array(5).fill(undefined, 1, 3)
        console.log(arr2, arr2[0], arr2[1]); // undefined undefined

        const arr3 = [1, 2, 3, 4, 5].fill(0, 1, 3)
        console.log(arr3, arr3[0], arr3[1]); // 1 0
    </script>
</body>
</html>